package com.nchu.student_score.controller;

import com.github.pagehelper.PageInfo;
import com.nchu.student_score.dataObject.ClazzResult;
import com.nchu.student_score.model.Clazz;
import com.nchu.student_score.service.ClazzService;
import com.nchu.student_score.vo.ResultVo;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/clazz")
public class ClazzController {
    @Resource
    ClazzService clazzService;

    @RequestMapping("getClazzList/{currPage}")
    public PageInfo<ClazzResult> getClazzList(@RequestBody ClazzResult clazzResult,@PathVariable Integer currPage){
        return clazzService.getClazzList(clazzResult,currPage);
    }

    @RequestMapping("updateClazz/{oldClazzId}")
    public ResultVo<Clazz> updateClazz(@RequestBody Clazz clazz,@PathVariable Integer oldClazzId){
        return clazzService.updateClazz(clazz,oldClazzId);
    }

    @RequestMapping("getClazz/{professionId}")
    public ResultVo<ClazzResult> getClazz(@PathVariable Integer professionId){
        return clazzService.getClazz(professionId);
    }

    @RequestMapping("findClazz/{clazzId}")
    public ResultVo<ClazzResult> findClazz(@PathVariable Integer clazzId){
        return clazzService.findClazz(clazzId);
    }
}
